﻿<Window x:Class="ResourceBlender_Express.WinMain"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:loc="clr-namespace:ResourceBlender_Express"
    xmlns:converters="clr-namespace:ResourceBlender_Express.Converters"
    Title="ResourceBlender Express" Visibility="Collapsed" WindowStartupLocation="CenterScreen"
    Height="500" Width="600"
    MinHeight="300" MinWidth="400"
    Loaded="Window_Loaded"
    Style="{StaticResource {x:Type Window}}" Icon="/ResourceBlender-Express;component/Resources/images/resourceblender.ico">
    <Window.Resources>
        <converters:LanguageCodeListStringifier x:Key="LanguageCodeListStringifier" />
        <converters:BundleNameStringifier x:Key="BundleNameStringifier" />
        <converters:CanEditAppConverter x:Key="CanEditAppConverter" />
        <Image x:Key="EditApp_16" Source="pack://application:,,,/Resources/images/application_edit_16.png" />
        <Image x:Key="DeleteApp_16" Source="pack://application:,,,/Resources/images/application_delete_16.png" />
        <DataTemplate x:Key="SummaryApplication" DataType="{x:Type loc:RBApplication}">
            <Border x:Name="PART_Border"
                    BorderThickness="1" CornerRadius="1">
                <Grid Margin="2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    
                    <TextBlock Grid.Row="0" IsHitTestVisible="True" Grid.Column="0" Grid.ColumnSpan="2" FontWeight="Bold" Text="{Binding DisplayName}" Style="{StaticResource HeadingFont}" Margin="0,0,0,5" />
                    <TextBlock Grid.Row="1" IsHitTestVisible="True" Grid.Column="0" Margin="0,0,5,0" FontWeight="Bold" Text="Bundles" Style="{StaticResource PaddedTextBlock}" />
                    <TextBlock Grid.Row="1" IsHitTestVisible="True" Grid.Column="1" TextWrapping="Wrap" Text="{Binding Bundles,Converter={StaticResource BundleNameStringifier}}" Style="{StaticResource PaddedTextBlock}" />
                    <TextBlock Grid.Row="2" IsHitTestVisible="True" Grid.Column="0" Margin="0,0,5,0" FontWeight="Bold" Text="Languages" Style="{StaticResource PaddedTextBlock}" />
                    <TextBlock Grid.Row="2" IsHitTestVisible="True" Grid.Column="1" TextWrapping="Wrap" Text="{Binding Languages,Converter={StaticResource LanguageCodeListStringifier}}" Style="{StaticResource PaddedTextBlock}" />
                    <WrapPanel Grid.Row="3" IsHitTestVisible="True" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,1,5,5">
                        <loc:ImageButton Image="Resources/images/arrow_right_16.png" ImageLocation="Right" Command="{x:Static loc:ResourceBlenderCommands.EditDefaultLanguage}" CommandParameter="{Binding}" IsEnabled="{Binding Converter={StaticResource CanEditAppConverter}}" ToolTipService.ShowOnDisabled="True" Text="Edit Default Language" />
                        <loc:ImageButton Image="Resources/images/arrow_right_16.png" ImageLocation="Right" Command="{x:Static loc:ResourceBlenderCommands.EditAllLanguages}" CommandParameter="{Binding}" IsEnabled="{Binding Converter={StaticResource CanEditAppConverter}}" ToolTipService.ShowOnDisabled="True" Text="Edit All Languages" />
                    </WrapPanel>
            </Grid>
            </Border>
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}},Path=IsSelected}" Value="True">
                    <Setter TargetName="PART_Border" Property="Background" Value="{StaticResource SelectedTransparentBackgroundBrush}" />
                    <Setter TargetName="PART_Border" Property="BorderBrush" Value="{StaticResource LightBorderBrush}" />
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>
    </Window.Resources>
    
    <DockPanel LastChildFill="True">
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="_File">
                <MenuItem Header="_Import...">
                    <MenuItem Header="_XML Backup" Command="loc:ResourceBlenderCommands.Import" CommandParameter="XML" />
                    <MenuItem Header="XML _Spreadsheet" Command="loc:ResourceBlenderCommands.Import" CommandParameter="XMLXLS" />
                </MenuItem>
                <MenuItem Header="_Export...">
                    <MenuItem Header="_XML Backup" Command="loc:ResourceBlenderCommands.Export" CommandParameter="XML" />
                    <MenuItem Header="XML _Spreadsheet" Command="loc:ResourceBlenderCommands.Export" CommandParameter="XMLXLS" />
                </MenuItem>
                <MenuItem Header="_Options" Command="loc:ResourceBlenderCommands.ShowOptions" InputGestureText="Alt+O" />
                <MenuItem Header="E_xit" Command="ApplicationCommands.Close" />
            </MenuItem>
            <MenuItem Header="_Resources">
                <MenuItem Header="Ge_nerate Resources" Command="loc:ResourceBlenderCommands.GenerateResources" />
                <MenuItem Header="_Edit Resources" Command="loc:ResourceBlenderCommands.ViewResourcesPrompt" />
                <!--MenuItem Header="Duplicate Resources" /-->
                <!--MenuItem Header="Unused Resources" /-->
                <Separator />
                <MenuItem Header="_Import From...">
                    <MenuItem Header="_Java (.properties)" Command="loc:ResourceBlenderCommands.Import" CommandParameter="Properties" />
                    <MenuItem Header="._NET Managed Resources (.resx)" Command="loc:ResourceBlenderCommands.Import" CommandParameter="Resx" />
                    <MenuItem Header="GNU _Portable Object (.po)" Command="loc:ResourceBlenderCommands.Import" CommandParameter="PO" />
                </MenuItem>
            </MenuItem>
            <MenuItem Header="_Help">
                <MenuItem Header="_About" Command="loc:ResourceBlenderCommands.ShowAbout" />
            </MenuItem>
        </Menu>
        <ToolBar x:Name="tlbMain" DockPanel.Dock="Top" VerticalAlignment="Top" HorizontalAlignment="Stretch" IsHitTestVisible="True" HorizontalContentAlignment="Left">
            <loc:ImageButton x:Name="btnApplications" Command="loc:ResourceBlenderCommands.ViewApplications" Text="Applications" Image="Resources/images/applications_32.png" ToolTip="Manage applications" Style="{StaticResource ToolBarButton}" />
            <loc:ImageButton x:Name="btnResources" Command="loc:ResourceBlenderCommands.ViewResourcesPrompt" Text="Resources" Image="Resources/images/resources_32.png" ToolTip="View and edit resources" Style="{StaticResource ToolBarButton}" />
            <loc:ImageButton x:Name="btnGenerate" Command="loc:ResourceBlenderCommands.GenerateResources" Text="Generate" Image="Resources/images/generate_32.png" ToolTip="Create output files from resources" Style="{StaticResource ToolBarButton}" />
            <Separator  />
            <loc:ImageButton x:Name="btnOptions" Command="loc:ResourceBlenderCommands.ShowOptions" Text="Options" Image="Resources/images/settings_32.png" Style="{StaticResource ToolBarButton}" />
        </ToolBar>
        <StatusBar DockPanel.Dock="Bottom" Height="24">
            <StatusBarItem x:Name="lblStatus" Visibility="Hidden">Loading Summary</StatusBarItem>
            <ProgressBar x:Name="prgStatus" IsIndeterminate="True" Visibility="Hidden" />
        </StatusBar>
        <TabControl DockPanel.Dock="Top" x:Name="tbcSummary" Background="Transparent" BorderThickness="0">
            <TabItem Height="0">
                <ListBox x:Name="lstApps" Style="{StaticResource InvisibleListBox}" ItemTemplate="{StaticResource SummaryApplication}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.CanContentScroll="False">
                    <ListBox.ContextMenu>
                        <ContextMenu>
                            <MenuItem Header="Edit" Icon="{StaticResource EditApp_16}" Command="loc:ResourceBlenderCommands.Edit" />
                            <MenuItem Header="Delete"  Icon="{StaticResource DeleteApp_16}" Command="loc:ResourceBlenderCommands.Delete" />
                        </ContextMenu>
                    </ListBox.ContextMenu>
                </ListBox>
            </TabItem>
            <TabItem Height="0">
                <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">No applications have been added, click Applications to add one.</TextBlock>
            </TabItem>
        </TabControl>
    </DockPanel>
</Window>
